<template>
  <div class="addPost">
    <div slot="title" style="padding:20px 10px">
      <span class="dialog-title">{{manage}}</span>
    </div>
    <el-form :model="addRoleForm" ref="addRoleForm" label-width="100px" class="addRole-form">
      <div class="addRole-form-top">
        <div class="addRole-item">
          <span class="input-lable">部门</span>
          <el-input
            v-model.trim="addRoleForm.department"
            placeholder="请输入"
            :disabled="manage === '编辑'? true : false"
          ></el-input>
        </div>
        <div class="addRole-item">
          <span class="input-lable">岗位角色</span>
          <el-input
            v-model.trim="addRoleForm.position"
            placeholder="请输入"
            :disabled="manage === '编辑'? true : false"
          ></el-input>
        </div>
      </div>
      <div class="addRole-form-bottom">
        <span class="input-lable">操作权限</span>
        <div class="authorities">
          <div v-for="(item,index) in authorities" :key="index" class="current_table">
            <span class="oneLevelTable">{{item.powername}}</span>
            <span
              v-if="item.tablelist.length == 0"
              @click="addBtn('power','',item)"
              :class="{currentselected: selectedRole.indexOf(item.power)>=0}"
            >{{item.powername}}</span>
            <ul v-if="item.tablelist.length != 0" class="twoLevelTable">
              <li v-for="(items,index) in item.tablelist" :key="index">
                <currentItenComponent
                  :itemdata="items"
                  :power="item.power"
                  :tabSelect="selectedRole"
                  :currentStatus="currentStatus"
                  :selectBtn="selectBtn"
                  @addTab="addTab"
                  @clearTab="clearTab"
                  @editClear="editClear"
                ></currentItenComponent>
              </li>
            </ul>
          </div>
        </div>
        <!-- <div class="authorities">
          <span
            v-for="(item,index) in authorities"
            :key="item.dictid"
            @click="handClick(item.dictname, item.dictid)"
            :class="{selected: selectedRole.indexOf(item.dictname)>=0}"
          >{{item.dictname}}</span>
        </div>-->
      </div>
    </el-form>
    <div class="dialog-footer">
      <el-button type="info" class="addUser-cancle" @click="cancleRoleDialog()">取消</el-button>
      <el-button type="primary" class="addUser-submit" @click="submitRoleForm()">提交</el-button>
    </div>
  </div>
</template>
<script src="./addPost.js">
</script>

<style scoped src="./addPost.css">
</style>
